package com.codereq.springxml;

import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.validator.constraints.Range;

@SuppressWarnings("restriction")
@XmlRootElement(name = "Book")
public class Book {

	private Integer bookId;
	private String bookName;

	public Book() {
	}

	public Book(Integer bookId, String bookName) {
		super();
		this.bookId = bookId;
		this.bookName = bookName;
	}

	@Range(min=1, max=100, message="min=1 && max=100")
	@XmlAttribute(name = "bookId")
	public Integer getBookId() {
		return bookId;
	}

	public void setBookId(Integer bookId) {
		this.bookId = bookId;
	}

	@Size(max=10, message="long max 10")
	@XmlAttribute(name = "bookName")
	public String getBookName() {
		return bookName;
	}

	public void setBookName(String bookName) {
		this.bookName = bookName;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}